
var express = require("express");
var path = require("path");


// // 用于接收post数据  并对数据做处理(第三方 运行依赖)  => express已经内置
// var bodyParser = require("body-parser");  // 老版本

var app = express(); //创建服务器 


// app.use(express.static(path.join(__dirname, "../site")));
app.use(express.json());//用于解析application/json
app.use(express.urlencoded({ extended: true }));   //用于解析application/x-www-urlencoded


var IndexRouter = require("./router/index");
var UserRouter = require("./router/user");
var GradeRouter = require("./router/grade");

// app.use(GradeRouter);
// app.use(UserRouter);


// path.join("/grade","/")  => /grade
// path.join("/grade","/search")  => /grade/search

// console.log(path.join("/grade", ""));
// console.log(path.join("/grade", "search"));

app.use(IndexRouter);
app.use("/grade", GradeRouter);
app.use("/user", UserRouter);


// 监听端口
app.listen(3000, () => {
    console.log("服务启动=>  http://localhost:3000");
})




